﻿using System;
using System.ComponentModel;

namespace SJM.DeliciousBookmarks
{
    public class Options
    {

        #region Fields

        private int? _amountOfResults = 100;

        private DateTime _lastUsedOn = new DateTime(2009, 1, 1);

        private string _parameters = "bloglist";

        private string _username = "simonjmartin";

        #endregion

        #region Properties

        [Description("This is the number of results you want to return. Leave this blank to return all bookmarks.")]
        [Category("Config")]
        public int? AmountOfResults
        {
            get { return _amountOfResults; }
            set
            {
                if (value == null)
                    value = 100;
                else if (value < 0)
                    throw new ArgumentOutOfRangeException("AmountOfResults", "The amount of results must be a positive number.");
                else
                    _amountOfResults = value;
            }
        }

        [Description("This is the date from which new bookmarks will be collected. It automatically updates after use.")]
        [Category("Config")]
        public DateTime LastUsedOn
        {
            get { return _lastUsedOn; }
            set { _lastUsedOn = value; }
        }

        [Description("Optional additional parameters for feeds. See http://delicious.com/help/feeds for list")]
        [Category("Config")]
        public string Parameters
        {
            get { return _parameters; }
            set { _parameters = value; }
        }

        [Description("This is the username for the bookmarks you want to display.")]
        [Category("Config")]
        public string Username
        {
            get { return _username; }
            set { _username = value; }
        }

        #endregion

        #region Public Methods

        public Options Clone()
        {
            return (Options)this.MemberwiseClone();
        }

        #endregion

    }
}
